<template>
  <div>
    <h1>第五题</h1>
    <p :style="{ background: color }">子鹏大帅比</p>
    <button @click="bgc">随机色</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      color: "",
    };
  },
  methods: {
    bgc() {
      let c1 = Math.floor(Math.random() * 256);
      let c2 = Math.floor(Math.random() * 256);
      let c3 = Math.floor(Math.random() * 256);
      //console.log(this.color);
      this.color = "rgb(" + c1 + "," + c2 + "," + c3 + ")";
    },
  },
};
</script>

<style>
p {
  margin: 0 auto;
  width: 200px;
  height: 100px;
}
</style>
